package dev.alm.javaproject.controller;

import dev.alm.javaproject.common.CommonResponse;
import dev.alm.javaproject.entity.Order;
import dev.alm.javaproject.mapper.OrderMapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("order")
public class OrderController {

    @Resource
    OrderMapper orderMapper;

    @PostMapping("getAllOrder")
    public CommonResponse getAllOrder() {
        List<Order> orders = orderMapper.selectList(null);
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.success();
        commonResponse.setData(orders);
        return commonResponse;
    }

}
